hysop.iterative_method module

Description of an iterative method (iteration, stopping criteria, …)

class hysop.iterative_method.IterativeMethod(stop_criteria, tolerance=1e-08, state_print=100, max_iter=10000, dt0=None, dt=None, configsimu=None, **kwargs)[source]

Bases: Problem

Overriding a Problem to enfoce a PseudoSimulation for iterative method loop.

The PseudoSimulation is created on each ‘apply’. There is no meaning for the underlying pseudo-time.

Notes

Sub-timestepping is not a usual use-case for this Problem. One should override Problem class in a proper way. Here only a pseudo-timestep is used together with a maximal number of iteration to compute a pseudo-final time.

Parameters:

kwds (arguments for base classes.)

Notes

The following base class variables cannot be specified during graph construction:

variables, input_variables, output_variables

Order of operation is: add_node, initialize, discretize,

get_work_properties, setup, apply, finalize.

Nodes can also be added during pre initialization step. Graph building is done at the end of the initialization step, after all internal nodes have been initialized.

apply(simulation, report_freq=0, dbg=None, **kwds)[source]

Abstract method that should be implemented. Applies this node (operator, computational graph operator…).

final_report()[source]
get_preserved_input_fields()[source]
run_iterations(simulation, report_freq=0, dbg=None, **kwds)[source]

This function si meant to clarify the profiling data

class hysop.iterative_method.PseudoSimulation(stop_criteria, tolerance=1e-08, **kwds)[source]

Bases: Simulation

Pseudo time-iterations for iterative method

Parameters:
  • stop_criteria (TensorParameter) – Iterative loop test for stopping is stop_criteria<tolerance

  • tolerance (float (optional)) – Tolerance for stopping criteria (default to 1e-8)

Notes

This object implement an iterative method in a pseudo-time inside a ‘real’ time interval. It can be used as sub-iterations for a fixed-point operator. It implements a loop defined as follows:

while(t<end and iteration<max_iter and max(stop_criteria)>tolerance)
advance(dbg=None, plot_freq=10)[source]

Proceed to next time.

  • Advance time and iteration number.

  • Compute the new timestep

  • check if simulation is over.

print_state(verbose=None)[source]

Print current iteration parameters